# Contributor: Rasmus Thomsen <oss@cogitri.dev>
# Maintainer: Rasmus Thomsen <oss@cogitri.dev>
pkgname=libpeas
pkgver=1.32.0
pkgrel=0
pkgdesc="GObject-based plugin system"
url="https://wiki.gnome.org/Projects/Libpeas"
arch="all"
license="LGPL-2.1-or-later"
makedepends="glib-dev gobject-introspection-dev intltool gtk+3.0-dev
	py3-gobject3-dev python3-dev meson vala glade-dev"
checkdepends="py3-gobject3 xvfb-run gobject-introspection"
subpackages="$pkgname-dev $pkgname-python3:py3 $pkgname-lang"
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=966951
# Doesn't find own introspection libs -> needs itself installed
options="!check"
source="https://download.gnome.org/sources/libpeas/${pkgver%.*}/libpeas-$pkgver.tar.xz"

build() {
	abuild-meson \
		-Dvapi=true \
		-Ddemos=false \
		. output
	meson compile ${JOBS:+-j ${JOBS}} -C output
}

check() {
	xvfb-run meson test -v -C output -t 10
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C output
}

py3() {
	depends="py3-gobject3"
	mkdir -p "$subpkgdir"/usr/lib/libpeas-1.0/loaders
	mv "$pkgdir"/usr/lib/libpeas-1.0/loaders/libpython3loader.* "$subpkgdir"/usr/lib/libpeas-1.0/loaders/
}

sha512sums="
520a5fd8657f75dc0e28a17ccab88a2952d018f81384eaea0fc65779e66b0ebc79b0dc8ce184e49d43406381c75c2028b402c1bb9d650eae2edf35ec8617a897  libpeas-1.32.0.tar.xz
"
